package util;

import java.util.Objects;


/**
 * Objects类测试
 */
public class ObjectsUtils {
    public static void main(String[] args) {
        equals();
        isNull();
        nonNull();
        requireNonNull();
    }

    private static void requireNonNull() {
//        System.out.println("Objects.requireNonNull(null) = " + Objects.requireNonNull(null));
        System.out.println("Objects.requireNonNull(null) = " + Objects.requireNonNull(null,"can not be null"));
    }

    private static void nonNull() {
        System.out.println("Objects.nonNull(null) = " + Objects.nonNull(null));
    }
    private static void isNull() {
        System.out.println("Objects.isNull(null) = " + Objects.isNull(null));
    }

    private static void equals() {
        System.out.println("Objects.equals(1,null) = " + Objects.equals(1, null));
        System.out.println("Objects.equals(1,1) = " + Objects.equals(1, 1));
    }
}
